package com.freshmarket.freshmarket.controller;


import com.freshmarket.freshmarket.entity.Transaction;
import com.freshmarket.freshmarket.service.impl.TransactionServiceImpl;
import com.freshmarket.freshmarket.utils.Result;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Squirrel
 * @since 2020-09-04
 */
@RestController
@RequestMapping("/freshmarket/transaction")
public class TransactionController {
    final TransactionServiceImpl transactionService;

    public TransactionController(TransactionServiceImpl transactionService) {
        this.transactionService = transactionService;
    }

    @RequestMapping("/selectTransaction")
    public Result selectTransaction(int pageIndex) throws Exception {
        List<Transaction> transactions = transactionService.selectAllTransaction(pageIndex);
        return Result.successResult(transactions);
    }
}

